package com.huangliusong.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.huangliusong.dataobject.OrderMaster;
import com.huangliusong.enums.ResultEnum;
import com.huangliusong.service.EasySendService;
import com.huangliusong.service.OrderService;
@Service
public class EasySendServiceImpl implements EasySendService {
	@Autowired
	private OrderService orderService;

	@Override
	public OrderMaster cancelOrder(String openid, String orderId) {
		OrderMaster orderMaster = orderService.findOne(orderId);
		if (orderMaster == null) {
			System.err.println("空");
			return null;
		}
		if (!orderMaster.getOpenId().equalsIgnoreCase(openid)) {
			System.err.println("不是本人");
			throw new EasySendException(ResultEnum.ORDER_OWNER_ERROR);
		}
		return orderMaster;
	}

}
